# -- coding: utf-8 --
import cv2
from skimage import measure,data,color

img = cv2.imread("/DataSet/Gastroscope biopsy/384*384/181039（2）/181039（2）_20.bmp")
#gray = cv2.CreateImage(cv2.GetSize(img),8,1)
gray = color.rgb2gray(img)
#cv2.CvtColor(img,gray,cv2.CV_BGR2GRAY)
aperture = 3
dst = cv2.CreateImage(cv2.GetSize(gray),cv2.IPL_DEPTH_32F,1)
cv2.Convert(dst,gray)
thresholded = cv.CloneImage(img)
cv2.threshold(img,thresholded,50,255,cv2.CV_THRESH_BINARY_INV)
cv2.ShowImage('laplaced grayscale',gray)
planes = [cv2.CreateImage(cv.GetSize(img),8,1) for i in range(3)]
laplace = cv2.CreateImage(cv.GetSize(img),cv2.IPL_DEPTH_16S,1)
colorlaplace = cv2.CreateImage(cv.GetSize(img),8,3)
cv2.Split(img,planes[0],planes[1],planes[2],None)
for plane in planes:
	cv2.laplace(plane,laplace,3)
	cv2.ConvertScaleAbs(laplace,plane,1,0)
cv2.Merge(planes[0],planes[1],planes[2],None,colorlaplace)
cv2.ShowImage('Laplace Color',colorlaplace)
cv2.Waitkey(0)